<template>
  <view class="index-container">
    <view class="content">
      <view class="tab-one" v-show="tabVal == 0">
        <!-- <swiper class="swiper">
			<swiper-item>
				<img class="image" src="@/static/one.png" alt="" />
			</swiper-item>
			</swiper> -->
        <!-- 查询积分 -->

        <!-- 查询区域 -->
        <!-- <search-card /> -->

        <!-- 积分商品列表 -->
        <!-- <view class="certificate-list">
			<certificate-card
				style="width: 50%"
				v-for="item in list"
				:key="item.key"
				:record="item"
				@tap="toDetail"
			/>
			</view> -->
      </view>
      <view class="tab-two" v-show="tabVal == 1"> 我的订单 </view>
    </view>
    <!-- tabbar -->
    <!-- <u-tabbar
      :value="tabVal"
      @change="tabChange"
      :fixed="false"
      :placeholder="false"
      :safeAreaInsetBottom="false"
    >
      <u-tabbar-item text="首页" icon="home" @click="toIndexPage"></u-tabbar-item>
      <u-tabbar-item text="我的订单" icon="account" @click="toOrderPage"></u-tabbar-item>
    </u-tabbar> -->

    <!-- <view style="height: 100vh">
      <chat
        @queryCallback="getQueryCallback"
        @openWebview="openWebview"
        @openMiniProgram="openMiniProgram"
      />
    </view> -->
	<player-component id="tvp-id" playerid="tvp" vid="s00242sxrne">
	<!-- 里面可以放插槽 -->
	里面可以放插槽
	</player-component>

  </view>
</template>

<script>
import searchCard from "./components/search-card.vue";
import certificateCard from "./components/certificate-card.vue";
export default {
  components: {
    searchCard,
    certificateCard,
  },
  data() {
    return {
      tabVal: 0,
      list: [
        {
          url: "https://img95.699pic.com/desgin_photo/40028/0471_list.jpg",
          name: "6元停车券",
          integrate: "100积分",
          key: 1,
        },
        {
          url: "https://pic.ntimg.cn/file/20221028/22164257_134410580107_2.jpg",
          name: "12元停车券",
          integrate: "100积分",
          key: 2,
        },
        {
          url: "https://img95.699pic.com/desgin_photo/40028/0471_list.jpg",
          name: "20元停车券",
          integrate: "100积分",
          key: 3,
        },
        {
          url: "https://img95.699pic.com/desgin_photo/40028/0471_list.jpg",
          name: "6元停车券",
          integrate: "100积分",
          key: 1,
        },
        {
          url: "https://pic.ntimg.cn/file/20221028/22164257_134410580107_2.jpg",
          name: "12元停车券",
          integrate: "100积分",
          key: 2,
        },
        {
          url: "https://img95.699pic.com/desgin_photo/40028/0471_list.jpg",
          name: "20元停车券",
          integrate: "100积分",
          key: 3,
        },
        {
          url: "https://img95.699pic.com/desgin_photo/40028/0471_list.jpg",
          name: "6元停车券",
          integrate: "100积分",
          key: 1,
        },
        {
          url: "https://pic.ntimg.cn/file/20221028/22164257_134410580107_2.jpg",
          name: "12元停车券",
          integrate: "100积分",
          key: 2,
        },
        {
          url: "https://img95.699pic.com/desgin_photo/40028/0471_list.jpg",
          name: "20元停车券",
          integrate: "100积分",
          key: 3,
        },
      ],
    };
  },
  onLoad() {
    // this.init();

    // uni.login({
    //   success: (res) => {
    //     // 通过code换取openid
    //     if (res.code) {
    //       uni.request({
    //         url: "",
    //         method: "post",
    //         data: {
    //           code: res.code,
    //         },
    //         success: (res) => {
    //           if (res.data && res.data.openid) {
    //             // 获取的openid存入storage，方便之后使用
    //             uni.setStorageSync("openId", res.data.openid);
    //           }
    //         },
    //       });
    //     }
    //   },
    //   fail: () => {},
    //   complete: () => {},
    // });
    // var plugin = requirePlugin("chatbot");
    // plugin.init({
    //   appid: "lU461pVKGpgaD5tzC4D2k0npOYie56", //微信对话开放平台小程序插件appid
    //   openid: "WUI0000000308", // 小程序用户的openid，必填项
	//   background: "rgba(253,333,222,1)",
    //   userHeader: "", // 用户头像,不传会弹出登录框
    //   userName: "", // 用户昵称,不传会弹出登录框
    //   anonymous: false, // 是否允许匿名用户登录，版本1.2.9后生效, 默认为false，设为true时，未传递userName、userHeader两个字段时将弹出登录框
    //   success: () => {}, //非必填
    //   fail: (error) => {}, //非必填
    // });

	
  },
  methods: {
    async init() {
      // 个人信息
      const res = (await this.$api.getCurrUser()) || {};
      console.log(data, "ddddddddddddddddd");
      if (res.success && res.data) {
        this.$store.commit("setCurrentUserInfo", res.data); // 保存到全局
        // 设置主题
        this.$store.commit("setThemeType", res.data?.themeType);
      }
    },
    tabChange(e) {
      //   console.log(e);
      this.tabVal = e;
    },
    toDetail(e) {
      console.log(e, "ssssss");
      uni.navigateTo({
        url: `/pages/certificate/certificate-car/certificate-car`,
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.index-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  .content {
    flex: 1;
    overflow: scroll;
    .swiper {
      height: 360rpx;
      .image {
        width: 100%;
        height: 100%;
      }
    }
  }
  ::v-deep .u-tabbar {
    flex: none;
    flex-shrink: 0;
  }
}
.certificate-list {
  display: flex;
  flex-wrap: wrap;
}
</style>